package com.hse.application;

import com.meshnetics.gb.stack.core.InformationBaseImpl;
import com.meshnetics.gb.stack.core.IBParameter;
import com.meshnetics.gb.type.DataType;
import com.meshnetics.gb.type.impl.GlobalFinalTypesRegistry;

/**
 * User: EGrinkrug
 * Date: May 8, 2009
 * Time: 3:47:08 PM
 * <!-- MIB is used only to map parameter codes to types -->
<information-base>
    <parameter  code="0x40"  name="macAckWaitDuration"            type="uint8"/>
    <parameter  code="0x41"  name="macAssociationPermit"          type="bool"/>
    <parameter  code="0x42"  name="macAutoRequest"                type="bool"/>
    <parameter  code="0x43"  name="macBattLifeExt"                type="bool"/>
    <parameter  code="0x44"  name="macBattLifeExtPeriod"          type="uint8"/>
    <parameter  code="0x45"  name="macBeaconPayload"              type="ostr"/>
    <parameter  code="0x46"  name="macBeaconPayloadLength"        type="uint8"/>
    <parameter  code="0x47"  name="macBeaconOrder"                type="uint8"/>
    <parameter  code="0x48"  name="macBeaconTxTime"               type="uint24"/>
    <parameter  code="0x49"  name="macBSN"                        type="uint8"/>
    <parameter  code="0x4a"  name="macCoordExtendedAddress"       type="uint64"/>
    <parameter  code="0x4b"  name="macCoordShortAddress"          type="uint16"/>
    <parameter  code="0x4c"  name="macDSN"                        type="uint8"/>
    <parameter  code="0x4d"  name="macGTSPermit"                  type="bool"/>
    <parameter  code="0x4e"  name="macMaxCSMABackoffs"            type="uint8"/>
    <parameter  code="0x4f"  name="macMinBE"                      type="uint8"/>
    <parameter  code="0x50"  name="macPANId"                      type="uint16"/>
    <parameter  code="0x51"  name="macPromiscuousMode"            type="bool"/>
    <parameter  code="0x52"  name="macRxOnWhenIdle"               type="bool"/>
    <parameter  code="0x53"  name="macShortAddress"               type="uint16"/>
    <parameter  code="0x54"  name="macSuperframeOrder"            type="uint8"/>
    <parameter  code="0x55"  name="macTransactionPersistenceTime" type="uint16"/>
    <parameter  code="0x6f"  name="macExtAddress"                 type="uint64"/>
</information-base>
 *
 */
public class MacInformationBase extends InformationBaseImpl {

    public MacInformationBase(){
        createParameter("0x40", "macAckWaitDuration",            "uint8" );
        createParameter("0x41", "macAssociationPermit",          "bool"  );
        createParameter("0x42", "macAutoRequest",                "bool"  );
        createParameter("0x43", "macBattLifeExt",                "bool"  );
        createParameter("0x44", "macBattLifeExtPeriod",          "uint8" );
        createParameter("0x45", "macBeaconPayload",              "ostr"  );
        createParameter("0x46", "macBeaconPayloadLength",        "uint8" );
        createParameter("0x47", "macBeaconOrder",                "uint8" );
        createParameter("0x48", "macBeaconTxTime",               "uint24");
        createParameter("0x49", "macBSN",                        "uint8" );
        createParameter("0x4a", "macCoordExtendedAddress",       "uint64");
        createParameter("0x4b", "macCoordShortAddress",          "uint16");
        createParameter("0x4c", "macDSN",                        "uint8" );
        createParameter("0x4d", "macGTSPermit",                  "bool"  );
        createParameter("0x4e", "macMaxCSMABackoffs",            "uint8" );
        createParameter("0x4f", "macMinBE",                      "uint8" );
        createParameter("0x50", "macPANId",                      "uint16");
        createParameter("0x51", "macPromiscuousMode",            "bool"  );
        createParameter("0x52", "macRxOnWhenIdle",               "bool"  );
        createParameter("0x53", "macShortAddress",               "uint16");
        createParameter("0x54", "macSuperframeOrder",            "uint8" );
        createParameter("0x55", "macTransactionPersistenceTime", "uint16");
        createParameter("0x6f", "macExtAddress",                 "uint64");
    }

    private void createParameter(String code, String name, String type){
        addParameter(new IBParameter(
                name,
                Integer.decode(code).intValue(),
                GlobalFinalTypesRegistry.INSTANCE.getType(type),
                null, null
        ));
    }
}
